package com.huadao.cart_ccs.data.task;

import com.huadao.cart_ccs.data.bo.MagneticStirrerBO;

import io.reactivex.disposables.Disposable;

public class StirrerTask extends OperateTask {

    private Disposable disposable;
    //起始速度
    private int startSpeed;
//    private MagneticStirrerBO magneticStirrerBO;

    public StirrerTask(int speed) {
        setSpeed(speed);
    }

//    public MagneticStirrerBO getMagneticStirrerBO() {
//        return magneticStirrerBO;
//    }
//
//    public void setMagneticStirrerBO(MagneticStirrerBO magneticStirrerBO) {
//        this.magneticStirrerBO = magneticStirrerBO;
//    }

    @Override
    public boolean isDuringTask() {
        if(state==STATE_UNSTART){
            return false;
        }else if(state==STATE_END){
            return false;
        }else {
            return true;
        }
    }

    public void setDisposable(Disposable disposable) {
        this.disposable=disposable;
    }

    //取消关闭任务
    public void cancelCloseTask() {
        //如果失败，就取消关闭任务
        if (disposable != null) {
            if (!disposable.isDisposed()) {
                disposable.dispose();
            }
            disposable = null;
        }
    }

    public int getStartSpeed() {
        return startSpeed;
    }

    public void setStartSpeed(int startSpeed) {
        this.startSpeed = startSpeed;
    }
}
